<?php

/**
 * @filename swoole_time.php 
 * @encoding UTF-8 
 * @author  fwz 
 * @datetime 2018-6-8  14:47:44
 */

//  循环定时

global $i;
swoole_timer_tick(3000,function($timer_id){
    global $i;
    echo "执行1 \n";
    if($i > 3){
        swoole_timer_clear($timer_id);
    }
    $i++;
});

// 一次性定时器
swoole_timer_after(7000,function(){
    echo "执行一次 \n ";
});
